using SqlSugar;

namespace WinFormsAppAotTest
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Button1_Click(object sender, EventArgs e)
        {
            StaticConfig.EnableAot = true;
            var db = new SqlSugarClient(new ConnectionConfig()
            {
                ConnectionString = $"Data Source={AppContext.BaseDirectory}/test1.db",
                DbType = DbType.Sqlite,
                IsAutoCloseConnection = true
            });
            db.DbMaintenance.CreateDatabase();

            db.CodeFirst.InitTables(typeof(AsTableLog));

            db.Insertable(new AsTableLog() { createtime = DateTime.Now }).ExecuteCommand();
        }
    }


    class AsTableLog
    {
        public Guid id { get; set; }
        public string msg { get; set; } = "";
        public DateTime createtime { get; set; }
    }
}
